function m = lpcvd_2DSurface_RMSslope(h,x,y)
s = [diff(h,1,2),h(:,1)-h(:,end)]./(x(2)-x(1));
nx = length(x);
ny = length(y);
m2 = 0.0;
for i =1:nx
    for j = 1:ny
        m2 = m2+s(i,j)^2;
    end
end
m = sqrt(m2/(nx*ny));

